/*
 * @Author: your name
 * @Date: 2020-09-13 09:08:35
 * @LastEditTime: 2020-09-13 16:07:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \woniutaofang\lib\pages\home\components\search_widget.dart
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
import 'package:woniutaofang/provider/city.dart';

class SearchWidget extends StatelessWidget {
  const SearchWidget({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Selector<CityProvider, CityProvider>(
        selector: (context, provider) => provider,
        shouldRebuild: (pre, next) => true,
        builder: (context, value, child) {
          return Container(
            width: ScreenUtil().setWidth(750),
            height: ScreenUtil().setHeight(100),
            color: Colors.red,
            padding: EdgeInsets.only(
              left: ScreenUtil().setWidth(15),
              right: ScreenUtil().setWidth(15),
            ),
            child: Row(
              children: <Widget>[
                Expanded(
                    flex: 9,
                    child: InkWell(
                      onTap: () => print('object'),
                      child: Container(
                        height: ScreenUtil().setHeight(60),
                        decoration: BoxDecoration(
                          border: Border.all(color: Colors.white),
                          color: Colors.white,
                          borderRadius: BorderRadius.all(
                            Radius.circular(30),
                          ),
                        ),
                        padding:
                            EdgeInsets.symmetric(horizontal: 10, vertical: 4),
                        child: Row(
                          children: <Widget>[
                            Icon(Icons.search,
                                color: Colors.grey[300], size: 18),
                            Text(
                              '请输入您想要搜索的内容',
                              style: TextStyle(
                                fontSize: 12,
                                color: Colors.grey[300],
                              ),
                            )
                          ],
                        ),
                      ),
                    )),
                SizedBox(
                  width: ScreenUtil().setWidth(10),
                ),
                Expanded(
                  flex: 3,
                  child: InkWell(
                    child: Container(
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          Text(
                            value.getcity(),
                            style: TextStyle(
                              fontSize: ScreenUtil().setSp(26),
                            ),
                          ),
                        ],
                      ),
                      height: ScreenUtil().setHeight(60),
                      decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.all(Radius.circular(30))),
                    ),
                  ),
                ),
              ],
            ),
          );
        });
  }
}
